using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace WebManager.Manager.Module
{
    public partial class List : System.Web.UI.Page
    {

        private LYQ.BLL.SysType bll = new LYQ.BLL.SysType();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData();
            }
        }


        private void BindData()
        {
            GridView1.DataSource = bll.GetList("").Tables[0];
            GridView1.DataBind();
        }
        protected void New_Click(object sender, EventArgs e)
        {
            string url = URLUtility.UrlBase + "/WebManager/manager/Module/New.aspx";
            Page.Response.Redirect(url);
        }

        protected void Edit_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Request.Form["selectCB"] == null) return;
            string[] sel = Request.Form["selectCB"].Split(',');   
            //if(sel.Length > 1)
            string url = URLUtility.UrlBase + "/WebManager/manager/Module/Edit.aspx?MID="+sel[0];
            Page.Response.Redirect(url);
        }

        protected void Delete_Click(object sender, EventArgs e)
        {
            string url = URLUtility.UrlBase + "/WebManager/manager/Module/List.aspx";
            Page.Response.Redirect(url);
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            BindData();
        }

     
    }
}
